<?php
require_once ("../db/connectdatabase.php");

function insertMucDichVay($id, $name) {
	$con = new ConnectDB();
	
	$tbl = "purposeloan";
	$fn = array('idpurpose' => $id, 'namepurp' => $name, 'datecreate' => time());
	return $con -> insert($tbl, $fn);
}

$result = false;
if(isset($_POST['act'])) {
	$action = $_POST['act'];
	if($action == 'add') {
		if(isset($_POST['namere'])) {
			$result = insertMucDichVay(time(), $_POST['namere']);
		}
	}
}

echo json_encode($result);
?>